package com.work.dyduser.utils;


import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

import com.work.dyduser.adapter.CommonAdapter;


/**
 * 取代ListView的LinearLayout，使之能够成功嵌套在ScrollView中
 * 
 * @author WZ 2016/1/31
 */
public class LinearLayoutForListView extends LinearLayout {
	private CommonAdapter adapter;
	private OnClickListener onClickListener = null;

	/**
	 * 绑定布局
	 */
	public void bindLinearLayout() {
		int count = adapter.getCount();
		this.removeAllViews();
		for (int i = 0; i < count; i++) {
			View v = adapter.getView(i, null, null);
			v.setOnClickListener(this.onClickListener);
			addView(v, i);
		}
	}

	public LinearLayoutForListView(Context context) {
		super(context);
	}
}